class HouseItem:
    def __init__(self,name,area):
        self.name=name
        self.area=area
class House:
    def __init__(self,type,total_area):
        self.type = type
        self.total_area=total_area
        self.free_area=total_area
        self.item_list=[]
    def add_itme(self,item):
        if self.free_area>item.area:
            self.item_list.append(item.name)
            self.free_area=self.free_area-item.area
        else:
            print('家具放不下了')
    def __str__(self):
        return f'剩余面基是{self.free_area}家具列表{self.item_list}'
if __name__=='__main__':
    bed = HouseItem(name='床',area=2)
    chest=HouseItem(name='衣柜',area=4)
    table=HouseItem(name='餐桌',area=700)

    home=House(type='别墅',total_area=300)

    home.add_itme(bed)
    print(home)

    home.add_itme(chest)
    print(home)

    home.add_itme(table)
    print(home)